package com.wu.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

	public static String getDate(Date date, String fm) {
		String dateString="";
		if (fm == null) {
			SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			dateString = formatter.format(date);
		} else {
			SimpleDateFormat formatter = new SimpleDateFormat(fm);
			dateString = formatter.format(date);
		}
		
		return dateString;
	}
	
	public static String getDate(String date, String fm) {
		String dateString="";
		if (fm == null) {
			SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			Long d=new Long(date);
			dateString = formatter.format(new Date(d));
		} else {
			SimpleDateFormat formatter = new SimpleDateFormat(fm);
			Long d=new Long(date);
			dateString = formatter.format(new Date(d));
		}
		
		return dateString;
	}
}
